package com.example.librarysystem.enums;

public enum BookStatusEnum {
    DELETED("删除", 0),
    NORMAL("正常", 1),
    FORBIDEN("不允许借阅", 2);
    private Integer code;
    private String desc;

    BookStatusEnum(String desc, Integer code) {
        this.desc = desc;
        this.code = code;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }
    public static BookStatusEnum getStatusByCode(Integer code) {
        switch(code){
            case 0:return BookStatusEnum.DELETED;
            case 1:return BookStatusEnum.NORMAL;
            case 2:return BookStatusEnum.FORBIDEN;
            default:return null;
        }
    }
}
